package com.google.code.shardbatis.converter;

import java.util.List;

import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.util.deparser.StatementDeParser;

public abstract class AbstractSqlConverter implements SqlConverter {
	
	@Override
	public List<SqlConverterOrderBy> getOrderBys(Statement statement) {
		return null;
	}
	
	@Override
	public String convert(Statement statement, String tableName) {
		return doDeParse(doConvert(statement, tableName));
	}
	
	protected String doDeParse(Statement statement) {
		StatementDeParser deParser = new StatementDeParser(new StringBuilder());
		statement.accept(deParser);
		return deParser.getBuffer().toString();
	}

	protected abstract Statement doConvert(Statement paramStatement, String tableName);
	
}